package com.holly.unit.deform.designer.enums;

import java.util.Objects;
import java.util.stream.Stream;

/**
 * 类描述: 自定义元素枚举类
 *
 * @author fxr
 * @version 1.0.0
 * @date 2022/8/4 13:28
 */
public enum  CustomElementEnum {

    /** 用户组件 */
    SELECT_USER("select-user"),
    /** 部门组件 */
    SELECT_DEPART("select-depart"),
    /** 表字典 */
    TABLE_DICT("table-dict"),
    /**自定义元素*/
    CUSTOM("custom");

    String fieldName;

    CustomElementEnum(String fieldName) {
        this.fieldName = fieldName;
    }

    public String fieldName() {
        return this.fieldName;
    }

    public static CustomElementEnum of(String fieldName) {
        return Stream.of(CustomElementEnum.values())
                .filter(clazz -> Objects.equals(clazz.fieldName(), fieldName))
                .findFirst()
                .orElse(CUSTOM);
    }



}
